-
Notifications
You must be signed in to change notification settings - Fork 13
support zstd and deflate auto compression #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support zstd and deflate auto compression #29
Conversation
scrapfly/extraction_config.py
Outdated
| """ | ||
|
|
||
| if len(data) < 2: | ||
| return 'unknown' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be None
scrapfly/extraction_config.py
Outdated
|
|
||
| # gzip | ||
| if data[0] == 0x1f and data[1] == 0x8b: | ||
| return 'gzip' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can directly use the CompressionFormatEnum, remove the translation between string to enum and add a return type accordingly
scrapfly/extraction_config.py
Outdated
| ] | ||
| for magic in zstd_magic_numbers: | ||
| if data[:len(magic)] == magic: | ||
| return 'zstd' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompressionFormatEnum
scrapfly/extraction_config.py
Outdated
| # deflate | ||
| if data[0] == 0x78: | ||
| if data[1] in (0x01, 0x5E, 0x9C, 0xDA): | ||
| return 'deflate' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompressionFormatEnum
* add config serialization/deserialization support * fix wrong types on config conversion * support zstd and deflate auto compression (#29) * support zstd and deflate auto compression * add auto compression detection support * update auto compression detection * use enums directly * remove debugging line and update method singature
No description provided.